/**
 * @Title: Test.java
 * @Description:
 * @author zsw
 * <p>
 * Copyright(C) 2018-2019    NPlus
 * Company:   无锡核心信息科技有限公司
 * @version V2.0.0
 * @Date: 13:20 2020/4/2
 * <p>
 * 修改历史:
 * Date                 Author        Version        Description
 * -----------------------------------------------------------------------------------
 * 13:20 2020/4/2       zsw        2.0.0           初始化版本
 */
package com.example.util;

import com.example.dataTransactionService.UserService;
import org.apache.commons.dbcp.BasicDataSource;

public class DataTransactionTest {
    private static final String jdbcDriver = "com.mysql.cj.jdbc.Driver";
    private static final String jdbcURL = "jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC";
    private static final String jdbcUsername = "root";
    private static final String jdbcPassword = "root";

    public static void main(String[] args) {
        BasicDataSource basicDataSource = new BasicDataSource();
        basicDataSource.setDriverClassName(jdbcDriver);
        basicDataSource.setUsername(jdbcUsername);
        basicDataSource.setPassword(jdbcPassword);
        basicDataSource.setUrl(jdbcURL);
        final UserService userService = new UserService(basicDataSource);
        for (int i = 0; i < 10; i++) {
            new Thread((Runnable) () -> {
                userService.action();
            }).start();
        }

        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


    }
}
